package org.example.demo;

import java.io.File;

/**
 * @ClassName Demo1
 * @Description
 * @Author zhangsw
 * @Date 2020/11/9 15:47
 * @Version 1.0
 */
public class Demo1 {
    public static void main(String[] args) {
        File file = new File("D:\\Users\\zhangsw\\Desktop\\转正申请-张士威");
        getAllFile(file, 0);
    }

    private static void getAllFile(File file, Integer i) {
        String str = "\t";
        if (!file.exists()) {
            return;
        }
        for (int j = 0; j < i; j++) {
            str += str;
        }
        for (File file1 : file.listFiles()) {
            if (file1.isDirectory()) {
                getAllFile(file1, ++i);
            } else {
                System.out.println(str + file1.getName());
            }
        }
    }
}
